package com.hw.pusher_example;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

public class DeepLinkActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_deep_link);
        g();
    }

    void g() {
        Intent intent = getIntent();
        if (null != intent) {
            // 方法1设置的数据通过如下方式获取
            String name1 = intent.getData().getQueryParameter("name");
//            int age1 = Integer.parseInt(intent.getData().getQueryParameter("age"));
            // 方法2设置的数据通过如下方式获取
            String name2 = intent.getStringExtra("name");
//            int age2 = intent.getIntExtra("age", -1);
            Toast.makeText(this, "name " + name1 + ",age " , Toast.LENGTH_SHORT).show();
        }
    }
}
